package com.adou.d15;

import java.util.*;
import java.util.stream.Stream;

public class StreamTest3 {
    public static void main(String[] args) {
        List<String> names = new ArrayList<>();
        Collections.addAll(names, "张三丰","张无忌","周芷若", "赵敏", "张强");
        Stream<String> stream = names.stream();


        Set<String> set = new HashSet<>();
        Collections.addAll(set, "张三丰","张无忌","周芷若", "赵敏", "张强");
        Stream<String> stream1 = set.stream();
        stream1.filter(t->t.contains("张")).forEach(t-> System.out.println(t));


        HashMap<String, Double> map = new HashMap<>();
        map.put("古力娜扎",172.3);
        map.put("迪丽热巴",162.3);
        map.put("马尔扎哈",182.3);
        map.put("卡尔眨巴",187.3);
        Stream<Double> stream3 = map.values().stream();
        Stream<Map.Entry<String, Double>> stream4 = map.entrySet().stream();
        Stream<String> stream2 = map.keySet().stream();

        stream4
                .filter(t->t.getKey().contains("巴"))
                .forEach(t-> System.out.println(t.getKey() + " ======== " + t.getValue()));


        String[] strs = {"张三丰","张无忌","周芷若", "赵敏", "张强"};
        Stream<String> stream5 = Arrays.stream(strs);

        Stream<String> stream6 = Stream.of("张三丰", "张无忌", "周芷若", "赵敏", "张强");


    }
}
